# Contributor: Aaron Hurt <ahurt@ena.com>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=pacparser
pkgver=1.4.2
pkgrel=1
pkgdesc="A library to parse proxy auto-config (PAC) files"
url="https://pacparser.manugarg.com/"
arch="all"
license="LGPL-3.0-or-later"
makedepends="bash python3-dev py3-setuptools"
subpackages="py3-$pkgname-pyc:pyc py3-$pkgname:pymod $pkgname-doc $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/manugarg/pacparser/archive/refs/tags/v$pkgver.tar.gz
	spidermonkey-make.patch
	vacopy.patch
	"

# secfixes:
#   1.4.0-r0:
#     - CVE-2019-25087

prepare() {
	default_prepare

	echo "VERSION=v$pkgver" > src/version.mk
}

build() {
	# There's some concurrency problem, so we must disable parallel build.
	# https://github.com/pacparser/pacparser/issues/27
	PYTHON=python3 make -j1 -C src pactester pymod
}

package() {
	make -C src DESTDIR="$pkgdir" install install-pymod
}

pymod() {
	depends="python3"
	replaces="py-pymod" # Backwards compatibility
	provides="py-pymod=$pkgver-r$pkgrel" # Backwards compatibility

	amove usr/lib/python*
}

sha512sums="
65d12421ee79a969b867d7dcec1527ac9b2596c25f6be2502742ba1b3788f05afeed2fcd5406dfb39485d1d56ef161684acabe6a95008725385c3c5336f331b1  pacparser-1.4.2.tar.gz
99753cfb450e685d866d80e33c58320584c15ec625a0745d4ea2b9d3a6eadb2308563d1b86bdc656a66d255b58a426a89cd5f14ea3b472d04a70a99ef3c1a2bf  spidermonkey-make.patch
c9b719d65c80482e78189eaabc51df2f367a02555345ec2eea82bb22aacd0fec59cef5e45d68336ea42758c61af575fea7417d9d0d09d7d87305060b5c37729b  vacopy.patch
"
